package logic;
import java.util.TimerTask;


public class SpaceControl extends TimerTask  {

	private Server server;
	public SpaceControl(Server server)
	{
		this.setServer(server);
	}
	@Override
	public void run() {
		int occupiedSpace = (int) ((int) (100 * Server.getChunkRepository().getRepositorySpaceOccupied())/Server.getChunkRepository().getRepositorySize());
		if(occupiedSpace >= Server.getSpaceControlPerc())
			server.reclaimSpace(0, true);
		
	}
	public Server getServer() {
		return server;
	}
	public void setServer(Server server) {
		this.server = server;
	}

}
